from fastapi import APIRouter, Query,UploadFile
from tortoise.expressions import Q
from app.controllers.mini.alert import mini_alert_controller
from app.models import CustomerUser, MiniAlert
from app.schemas.base import Success, SuccessExtra,Fail
from app.schemas.mini import *
from app.core.dependency import DependCustomerAuth
from app.core.ctx import CTX_USER_ID
from app.utils.upload import upload_image,upload_file

mini_alert_router = APIRouter()
model_name = "弹屏"



@mini_alert_router.get("/list", summary=f"查看{model_name}列表")
async def do_mini_alert_list(
        page: int = Query(1, description="页码"),
        page_size: int = Query(10, description="每页数量"),
):
    q = Q(is_active=1)
    total, data = await mini_alert_controller.do_list(page=page, page_size=page_size, search=q)
    return SuccessExtra(data=data, total=total, page=page, page_size=page_size)

